package com.xiaoaoc.SmartToilet.controller;

import com.xiaoaoc.SmartToilet.mqtt.MqttPushClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/mqtt")
public class MqttController {
    @Autowired
    private MqttPushClient mqttPushClient;

    @PostMapping("/turn_right")
    public void turn_right(){
        mqttPushClient.publish("toilet/control","turn_right");
        System.out.println("已发送");
    }

    @PostMapping("/regress_middle")
    public void regress_middle(){
        mqttPushClient.publish("toilet/control","regress_middle");
        System.out.println("已发送");
    }

    @PostMapping("/turn_left")
    public void turn_left(){
        mqttPushClient.publish("toilet/control","turn_left");
        System.out.println("已发送");
    }
}
